﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ArtMath
{
    public class clsSB : clsFormulaBase
    {
        clsFormulaBase ds, zs;

        public clsSB(PictureBox pb, clsFormulaBase ds, clsFormulaBase zs) : base(pb)
        {
            DS = ds;
            ZS = zs;
            Size = new SizeD(ds.Size.Width + zs.Size.Width, Math.Max(ds.Size.Height, ds.Size.Height / 2 + zs.Size.Height));
        }
        public clsFormulaBase DS
        {
            get { return ds; }
            set
            {
                ds = value;
                picturebox.Invalidate();
            }
        }
        public clsFormulaBase ZS
        {
            get { return zs; }
            set
            {
                zs = value;
                picturebox.Invalidate();
            }
        }
        public override void setChildLocation()
        {
            ds.Location = new PointD(Location.X, Bottom - ds.Size.Height);
            zs.Location = new PointD(Right - zs.Size.Width, Location.Y);
        }
        public override void Paint(Graphics gra)
        {
            ds.Paint(gra);
            zs.Paint(gra);
            base.Paint(gra);
        }
        public override string ToString()
        {
            return "pow(" + ds.ToString() + ", " + zs.ToString() + ")";
        }
    }
}
